home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / editor / hp540fwn.lzh / PrintEnvelope
Text File  |  1995-10-23  |  4KB  |  74 lines

  1. /* filename: PrintEnvelope                                                  */
  2. /*  version: 1.2     23 Oct 95                                              */
  3. /*                                                                          */
  4. /*  purpose: FinalWriter macro to print a return and recipient address on a */
  5. /*           single-fed envelope on an HP540 (or other HP printers which    */
  6. /*           support single-fed #10 envelopes). This would most often be    */
  7. /*           used from within a document being created which will be        */
  8. /*           mailed to someone, using a business format where their         */
  9. /*           address is part of the document.                               */
  10. /*                                                                          */
  11. /*   syntax: called from within FinalWriter                                 */
  12. /*                                                                          */
  13. /*   author: Jim Dutton                                                     */
  14. /*           jimd@slip106.termserv.siu.edu                                  */
  15. /*           ca0008@siucvmb.siu.edu                                         */
  16. /*                                                                          */
  17. /*  prereqs: ENV:FW/MyName, ENV:FW/MyAddress, ENV:FW/MyCityStateZip         */
  18. /*                                                                          */
  19. /*    usage: set the prerequisite Environment variables with your desired   */
  20. /*           return address (your return address can be one or two lines)   */
  21. /*                                                                          */
  22. /*           create FW document WITH recipient address as part of the text, */
  23. /*           in the format of a mailing address (ie; seperate lines)        */
  24. /*                                                                          */
  25. /*           highlight the recipient address text and invoke this macro     */
  26. /*                                                                          */
  27. /* comments: the UNIVERS font is preselected - the envelope print setup is  */
  28. /*           predetermined by the printer - only use envelopes that your    */
  29. /*           printer supports - the "EXTRACT" comment obtains the recipient */
  30. /*           address data from FinalWriter                                  */
  31.  
  32. Options Results
  33.  
  34. If ~open(hp540,'PAR:')  then
  35.   Do; say '** Unable to open PARallel port **'; Exit 32; End
  36.  
  37. If ~open(envname,"ENV:FW/MyName")  then
  38.   Do; say '** Unable to open ENV:FW/MyName **'; Exit 33; End
  39. myname = strip(readln(envname)); duh = close(envname)
  40.  
  41. If ~open(envaddr,"ENV:FW/MyAddress")  then
  42.   Do; say '** Unable to open ENV:FW/MyAddress **'; Exit 34; End
  43. myaddress.1 = strip(readln(envaddr))
  44. If ~eof(envaddr)  then  myaddress.2 = strip(readln(envaddr))
  45. Else                    myaddress.2 = ""
  46. duh = close(envaddr)
  47.  
  48. If ~open(envstate,"ENV:FW/MyCityStateZip")  then
  49.   Do; say '** Unable to open ENV:FW/MyCityStateZip **'; Exit 35; End
  50. myCityStateZip = strip(readln(envstate)); duh = close(envstate)
  51.  
  52. esc = '1B'x; reset = esc || "E"; line_termination = esc || "&k3G"
  53. univers = esc || "(s1p12v0s0b52T"
  54. paper_size.envelope = esc || "&l81A"
  55. EnvelopeFeed = esc || "&l3H"
  56. LeftMargin50_Skip8Rows = esc || "&a50l&a+8R"
  57.  
  58. duh = writeln(hp540,reset)
  59. duh = writeln(hp540,line_termination)
  60. duh = writech(hp540,univers)
  61. duh = writech(hp540,paper_size.envelope)
  62. duh = writeln(hp540,EnvelopeFeed)
  63.  
  64. duh = writeln(hp540,myname);  duh = writeln(hp540,myaddress.1)
  65. If myaddress.2 ~= ""  then    duh = writeln(hp540,myaddress.2)
  66. duh = writeln(hp540,myCityStateZip)
  67.  
  68. duh = writeln(hp540,LeftMargin50_Skip8Rows)
  69.  
  70. "Extract";  duh = writech(hp540,Result)
  71.  
  72. duh = writeln(hp540,reset);  duh = close(hp540)
  73. Exit
  74.